package com.qianxiwitdoctor.service;
import java.util.HashMap;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qianxi.wit.pojo.TbDoctor;
import com.qianxiwitdoctor.mapper.DoctorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 服务实现层
 * @author Administrator
 *
 */
@Service
public class DoctorServiceImpl{

	@Autowired
	private DoctorMapper doctorMapper;


	public Page<TbDoctor> auditList(int doctorStatus, Long hospitalId, Long doctorTime, Long pageNum, Long pageSize) {
		Page<TbDoctor> page = new Page<>(pageNum,pageSize);

		QueryWrapper<TbDoctor> wrapper = new QueryWrapper<>();
		wrapper.eq("doctor_status",doctorStatus);

		if(0L!=hospitalId){
			wrapper.eq("hospital_id",hospitalId);
		}
		if(0L!=doctorTime){
			wrapper.eq("doctor_time",doctorTime);
		}

		doctorMapper.selectPage(page,wrapper);

		return page;
	}

	public void doctorstatuc(int doctorId, long status) {
		TbDoctor doctor = doctorMapper.selectById(doctorId);
		doctor.setDoctorStatus((int) status);

		doctorMapper.updateById(doctor);
	}

	public TbDoctor findById(long doctorId) {
		return doctorMapper.selectById(doctorId);
	}
}
